

from tkinter import *
from tkinter import messagebox
from tkinter import filedialog
from tkinter import colorchooser


root=Tk()


# messagebox.askokcancel("我勒个去",
#     "ok")


# messagebox.showinfo("我勒个去",
#     "1")


# messagebox.askquestion("我勒个去",
#     "2")

def openfile():
    filename = filedialog.askopenfilename(
        defaultextension=".png",
        # 下拉文件类型选项
        filetypes=[
            ("PNG",".png"),
            ("GIF",".gif"),
            ("JPG",".jpg")
        ])


    print(filename)

Button(root,text="openFile",
    command=openfile).pack()


def opencolor():
    filename = colorchooser.askcolor()
    
    print(filename)



Button(root,text="color",
    command=opencolor).pack()






mainloop()